<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.sfd.entity.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'st_allbooks.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script language="javascript">
function viewArc(aid){
	if(aid==0) aid = getOneItem();
	window.open("archives.asp?aid="+aid+"&action=viewArchives");
}
function editArc(aid){
	if(aid==0) aid = getOneItem();
	location="archives.asp?aid="+aid+"&action=editArchives";
}
function updateArc(aid){
	location.reload();
}
function checkArc(aid){
	var qstr=getCheckboxItem();
	if(aid==0) aid = getOneItem();
	location="archives.asp?aid="+aid+"&action=checkArchives&qstr="+qstr+"";
}
function moveArc(aid){
	var qstr=getCheckboxItem();
	if(aid==0) aid = getOneItem();
	location="archives.asp?aid="+aid+"&action=moveArchives&qstr="+qstr+"";
}
function adArc(aid){
	var qstr=getCheckboxItem();
	if(aid==0) aid = getOneItem();
	location="archives.asp?aid="+aid+"&action=commendArchives&qstr="+qstr+"";
}
function delArc(aid){
	var qstr=getCheckboxItem();
	if(aid==0) aid = getOneItem();
	location="archives.asp?aid="+aid+"&action=delArchives&qstr="+qstr+"";
}

//获得选中文件的文件名
function getCheckboxItem()
{
	var allSel="";
	if(document.form2.id.value) return document.form2.id.value;
	for(i=0;i<document.form2.id.length;i++)
	{
		if(document.form2.id[i].checked)
		{
			if(allSel=="")
				allSel=document.form2.id[i].value;
			else
				allSel=allSel+"`"+document.form2.id[i].value;
		}
	}
	return allSel;
}

//获得选中其中一个的id
function getOneItem()
{
	var allSel="";
	if(document.form2.id.value) return document.form2.id.value;
	for(i=0;i<document.form2.id.length;i++)
	{
		if(document.form2.id[i].checked)
		{
				allSel = document.form2.id[i].value;
				break;
		}
	}
	return allSel;
}
function selAll()
{
	for(i=0;i<document.form2.id.length;i++)
	{
		if(!document.form2.id[i].checked)
		{
			document.form2.id[i].checked=true;
		}
	}
}
function isone()
{
	 var count = 0;
	 for(i=0;i<document.form2.id.length;i++)
	 {
		if(document.form2.id[i].checked)
		{   
			count ++;
			
		}
	}
	if (count < 1) 
	{
	    alert("没有选择数据！");
		return;
    }
         
    if (count > 1) 
	{
         alert("只可选择一条信息");
		 return;
    }
	else{
	location="roleset.html?height=400;width=300";
	}
}
function noone()
{
	var count=0;
	for(i=0;i<document.form2.id.length;i++)
	{
		if(document.form2.id[i].checked)
		{
			count++;
		}
	}
	if(count==0)
	{
		alert("您没有选择删除目标！");
		return;
	}
	else{
	    alert("您已成功删除目标！");
		location.reload();

	}
}
function noSelAll()
{
	for(i=0;i<document.form2.id.length;i++)
	{
		if(document.form2.id[i].checked)
		{
			document.form2.id[i].checked=false;
		}
	}
}
</script>
</head>
<body bgcolor="#009edb" leftmargin="0" background='../参考原型-2/skin/images/allbg.gif'>

<!--  快速转换位置按钮  -->

  
<!--  内容列表   -->
<form name="form2"  action="/librarysystem/studentServlet" method="post">

<table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
<tr align="center" bgcolor="#E7E7E7">
	<td height="24" colspan="10" background="../参考原型-2/skin/images/tbg.gif">&nbsp;图书信息列表&nbsp;</td>
	</tr>
<tr align="center" bgcolor="#FAFAF1" height="22">
	<td width="7%">选择</td>
	<td width="5%">ID</td>
	<td width="9%">图书名称</td>
	<td width="11%">作者</td>
	<td width="11%">出版社</td>
	<td width="10%">入馆日期</td>
	<td width="10%">单价</td>
	<td width="10%">状态</td>
	<td width=10%colspan="3" >基本操作</td>
    </tr>

<%
 			List book_List = (List)request.getAttribute("book_List");
			
	    		System.out.println(book_List.size());
				
	    	for (int i=0;i<book_List.size();i++){
			
	    		Book book=(Book)book_List.get(i);
	
	
%>
<tr align='center' bgcolor="#FFFFFF"
	onMouseMove="javascript:this.bgColor='#149ff8';" 
	onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
	
	<td><input name="id" type="checkbox" id="id" value="101" class="np"></td>
    <td><%=book.getBookID() %></td>
	<td><%=book.getBookName() %></td>
	<td><%=book.getAuthor() %></td>
	<td><%=book.getPublish() %></td>
	<td><%=book.getBuyTime() %></td>
	<td><%=book.getBookPrice() %></td>
	<td><%=book.getBookStatus() %></td>
    <td width="10%"><a href="/librarysystem/studentServlet?actioncode=querydetail&bookID=<%=book.getBookID() %>">详情</a></td>
    

</tr>
<%
	    	}
%>

<tr align="center" bgcolor="#FAFAF1">
  <td height="28" colspan="9">
    &nbsp;
    <a href="javascript:selAll()" class="coolbg">全选</a>
    <a href="javascript:noSelAll()" class="coolbg">取消</a>
    <a href="javascript:updateArc()" class="coolbg">&nbsp;&nbsp;</a>
    <a href="javascript:updateArc(0)" class="coolbg">&nbsp;上一页&nbsp;</a>
    <a href="javascript:updateArc(0)" class="coolbg">&nbsp;下一页&nbsp;</a>
    <a href="javascript:borrow()" class="coolbg">&nbsp;借阅&nbsp;</a>
   
  </td>
</tr>
<tr align="center" bgcolor="#EEF4EA">
	<td height="36" colspan="9"><!--翻页代码 --></td>
	</tr>
</table>
<input type="hidden" id="actioncode" name=actioncode value=""/>
</form>
</body>
</html>
